
import httpReuqest from '@/assets/httpsRequest';

export default {
  namespaced: true,
  state: {
    swiperData: [],
  },
  actions: {
    async getSwiper({ commit }) {
      const res = await httpReuqest({
        method: 'get',
        // easy-mock接口
        url: 'https://www.easy-mock.com/mock/5c3a18ddcbbb0462fb0e27fa/kkb/getlunbo',
      });
      const { status, data = {} } = res;
      const { message = [] } = data;
      if (status === 200) {
        commit({
          type: 'setSwiper',
          payload: {
            swiperData: message,
          },
        });
      }
    },
  },
  mutations: {
    setSwiper(state, { payload }) {
      Object.assign(state, payload);
    },
  },
  getters: {},
};
